{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "sys.path.append('/home/jquser')\n",
    "from at_grid import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# file_path='Data/'\n",
    "# file_name='网格-交易A.xlsm' \n",
    "etf_dict=get_wg_info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>名称</th>\n",
       "      <th>代码</th>\n",
       "      <th>当前价</th>\n",
       "      <th>买入价</th>\n",
       "      <th>买入数</th>\n",
       "      <th>卖出价</th>\n",
       "      <th>卖出数</th>\n",
       "      <th>说明</th>\n",
       "      <th>当前格</th>\n",
       "      <th>末格</th>\n",
       "      <th>首格</th>\n",
       "      <th>格数</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>银行ETF</td>\n",
       "      <td>512800</td>\n",
       "      <td>0.978</td>\n",
       "      <td>0.947</td>\n",
       "      <td>800</td>\n",
       "      <td>0.990</td>\n",
       "      <td>800</td>\n",
       "      <td></td>\n",
       "      <td>0.968</td>\n",
       "      <td>0.887</td>\n",
       "      <td>1.180</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>H股ETF</td>\n",
       "      <td>510900</td>\n",
       "      <td>1.201</td>\n",
       "      <td>1.172</td>\n",
       "      <td>900</td>\n",
       "      <td>1.224</td>\n",
       "      <td>800</td>\n",
       "      <td></td>\n",
       "      <td>1.198</td>\n",
       "      <td>0.945</td>\n",
       "      <td>1.306</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>证券ETF</td>\n",
       "      <td>512880</td>\n",
       "      <td>0.879</td>\n",
       "      <td>0.851</td>\n",
       "      <td>1200</td>\n",
       "      <td>0.894</td>\n",
       "      <td>1100</td>\n",
       "      <td></td>\n",
       "      <td>0.872</td>\n",
       "      <td>0.698</td>\n",
       "      <td>1.295</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>创业板</td>\n",
       "      <td>159915</td>\n",
       "      <td>1.363</td>\n",
       "      <td>1.308</td>\n",
       "      <td>800</td>\n",
       "      <td>1.380</td>\n",
       "      <td>700</td>\n",
       "      <td></td>\n",
       "      <td>1.344</td>\n",
       "      <td>1.099</td>\n",
       "      <td>1.951</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>创业板50</td>\n",
       "      <td>159949</td>\n",
       "      <td>0.498</td>\n",
       "      <td>0.481</td>\n",
       "      <td>2100</td>\n",
       "      <td>0.515</td>\n",
       "      <td>2000</td>\n",
       "      <td></td>\n",
       "      <td>0.498</td>\n",
       "      <td>0.433</td>\n",
       "      <td>0.785</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>500ETF</td>\n",
       "      <td>510500</td>\n",
       "      <td>5.023</td>\n",
       "      <td>4.727</td>\n",
       "      <td>200</td>\n",
       "      <td>5.045</td>\n",
       "      <td>200</td>\n",
       "      <td></td>\n",
       "      <td>4.883</td>\n",
       "      <td>4.430</td>\n",
       "      <td>7.658</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>华宝油气</td>\n",
       "      <td>162411</td>\n",
       "      <td>0.520</td>\n",
       "      <td>0.504</td>\n",
       "      <td>1200</td>\n",
       "      <td>0.534</td>\n",
       "      <td>1100</td>\n",
       "      <td></td>\n",
       "      <td>0.518</td>\n",
       "      <td>0.504</td>\n",
       "      <td>0.824</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>券商ETF</td>\n",
       "      <td>512000</td>\n",
       "      <td>0.837</td>\n",
       "      <td>0.807</td>\n",
       "      <td>1200</td>\n",
       "      <td>0.848</td>\n",
       "      <td>1200</td>\n",
       "      <td></td>\n",
       "      <td>0.827</td>\n",
       "      <td>0.662</td>\n",
       "      <td>1.228</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       名称      代码    当前价    买入价   买入数    卖出价   卖出数 说明    当前格     末格     首格  格数\n",
       "0   银行ETF  512800  0.978  0.947   800  0.990   800     0.968  0.887  1.180  14\n",
       "1   H股ETF  510900  1.201  1.172   900  1.224   800     1.198  0.945  1.306  16\n",
       "2   证券ETF  512880  0.879  0.851  1200  0.894  1100     0.872  0.698  1.295  26\n",
       "3     创业板  159915  1.363  1.308   800  1.380   700     1.344  1.099  1.951  21\n",
       "4   创业板50  159949  0.498  0.481  2100  0.515  2000     0.498  0.433  0.785  21\n",
       "5  500ETF  510500  5.023  4.727   200  5.045   200     4.883  4.430  7.658  21\n",
       "6    华宝油气  162411  0.520  0.504  1200  0.534  1100     0.518  0.504  0.824  18\n",
       "7   券商ETF  512000  0.837  0.807  1200  0.848  1200     0.827  0.662  1.228  26"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "notice_df=get_wg_notice(etf_dict)\n",
    "notice_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<table border=\"1\" cellspacing=\"0\" cellpadding=\"6\" rules=\"rows\" frame=\"void\">\n",
      "  <thead style=\"font-size:12px\">\n",
      "    <tr style=\"text-align: right;\">\n",
      "      <th align=\"left\">名称</th>\n",
      "      <th align=\"left\">代码</th>\n",
      "      <th>当前价</th>\n",
      "      <th>买入价</th>\n",
      "      <th>买入数</th>\n",
      "      <th>卖出价</th>\n",
      "      <th>卖出数</th>\n",
      "    </tr>\n",
      "  </thead>\n",
      "  <tbody style=\"text-align:right;font-size:12px\">\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">银行ETF</td>\n",
      "      <td align=\"left\">512800</td>\n",
      "      <td>0.978</td>\n",
      "      <td>0.947</td>\n",
      "      <td>800</td>\n",
      "      <td>0.990</td>\n",
      "      <td>800</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">H股ETF</td>\n",
      "      <td align=\"left\">510900</td>\n",
      "      <td>1.201</td>\n",
      "      <td>1.172</td>\n",
      "      <td>900</td>\n",
      "      <td>1.224</td>\n",
      "      <td>800</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">证券ETF</td>\n",
      "      <td align=\"left\">512880</td>\n",
      "      <td>0.879</td>\n",
      "      <td>0.851</td>\n",
      "      <td>1200</td>\n",
      "      <td>0.894</td>\n",
      "      <td>1100</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">创业板</td>\n",
      "      <td align=\"left\">159915</td>\n",
      "      <td>1.363</td>\n",
      "      <td>1.308</td>\n",
      "      <td>800</td>\n",
      "      <td>1.380</td>\n",
      "      <td>700</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">创业板50</td>\n",
      "      <td align=\"left\">159949</td>\n",
      "      <td>0.498</td>\n",
      "      <td>0.481</td>\n",
      "      <td>2100</td>\n",
      "      <td>0.515</td>\n",
      "      <td>2000</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">500ETF</td>\n",
      "      <td align=\"left\">510500</td>\n",
      "      <td>5.023</td>\n",
      "      <td>4.727</td>\n",
      "      <td>200</td>\n",
      "      <td>5.045</td>\n",
      "      <td>200</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">华宝油气</td>\n",
      "      <td align=\"left\">162411</td>\n",
      "      <td>0.520</td>\n",
      "      <td>0.504</td>\n",
      "      <td>1200</td>\n",
      "      <td>0.534</td>\n",
      "      <td>1100</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">券商ETF</td>\n",
      "      <td align=\"left\">512000</td>\n",
      "      <td>0.837</td>\n",
      "      <td>0.807</td>\n",
      "      <td>1200</td>\n",
      "      <td>0.848</td>\n",
      "      <td>1200</td>\n",
      "    </tr>\n",
      "  </tbody>\n",
      "</table>\n"
     ]
    }
   ],
   "source": [
    "print get_wg_report(notice_df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import xlrd\n",
    "import collections\n",
    "\n",
    "import sys\n",
    "sys.path.append('/home/jquser')\n",
    "from at_grid import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "code_folding": [
     90
    ],
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "def get_wg_info(file_name):\n",
    "\n",
    "    # 打开excel文件\n",
    "    xlr_f=xlrd.open_workbook(file_name)\n",
    "\n",
    "    \n",
    "    # 获取第一个表\n",
    "    table=xlr_f.sheet_by_index(0)\n",
    "\n",
    "    # 获取标的列表\n",
    "    etf_list=[str(item)[:6] for item in table.col_values(2)[4:] if item is not u'']\n",
    "\n",
    "    # 标的信息有序字典 \n",
    "    etf_dict={}\n",
    "    etf_dict=collections.OrderedDict()\n",
    "    \n",
    "    # 遍历所有工作表\n",
    "    for i,code in zip(range(1,len(etf_list)+2),etf_list):\n",
    "        table=xlr_f.sheet_by_index(i)\n",
    "        \n",
    "        # 获取标的的网格价格、买入数量、卖出数量\n",
    "        price_list=[round(item,3) for item in table.col_values(2)[6:] if item is not u'']\n",
    "        buy_list=[int(item) for item in table.col_values(4)[6:] if item is not u'']\n",
    "        sell_list=[int(item) for item in table.col_values(5)[6:] if item is not u'']\n",
    "               \n",
    "        # 保存到字典\n",
    "        etf_dict.update({code:{'name':table.name,\n",
    "                           'value':{'price': price_list, 'buy': buy_list, 'sell': sell_list}}})\n",
    "    return etf_dict\n",
    "\n",
    "\n",
    "def get_wg_notice(etf_dict):    \n",
    "    data_ist=[] \n",
    "        \n",
    "    # 当前时间\n",
    "    end_date=pd.datetime.today()\n",
    "    \n",
    "    # 遍历标的信息字典\n",
    "    for code in etf_dict.keys():\n",
    "        # 获取收盘价格\n",
    "        current_price=get_price(normalize_code(code),end_date=end_date,count=1,\n",
    "                        frequency='daily',fields=['close'])['close'].iloc[-1]\n",
    "        current_price=round(current_price,3)\n",
    "        \n",
    "        # 获取名称、当前价格、网格价格表、买入数量表、卖出数量表\n",
    "        name=etf_dict.get(code).get('name')\n",
    "        price_list=etf_dict.get(code).get('value').get('price')\n",
    "        buy_list=etf_dict.get(code).get('value').get('buy')\n",
    "        sell_list=etf_dict.get(code).get('value').get('sell')\n",
    "        \n",
    "        # 价格格位计数器\n",
    "        i=0\n",
    "        \n",
    "        # 最接近的价格\n",
    "        near_price=0\n",
    "        \n",
    "        # 遍历价格列表\n",
    "        for item in price_list:\n",
    "            # 以当前价格查找最接近的格位价格\n",
    "            if current_price >= item :\n",
    "                # 找到则跳出循环\n",
    "                near_price=item\n",
    "                break\n",
    "            # 档位计数器递增\n",
    "            i+= 1  \n",
    "        \n",
    "        count=len(price_list)\n",
    "        # 判断格位情况\n",
    "        if i==count:  \n",
    "            # 当前价格低于最后一格，即破网、满仓\n",
    "            # print name,code,current_price,0,0,price_list[i-2],sell_list[i-2],'破网'\n",
    "            data_ist.append([name,code,current_price,'-','满仓',price_list[i-2],sell_list[i-2],\n",
    "                             '破网','-',price_list[-1],price_list[0],count])\n",
    "        elif i==0:\n",
    "            # 当前价格高于0格，即清仓\n",
    "            # print name,code,current_price,price_list[i+1],buy_list[i+1],'-','清仓','清仓'\n",
    "            data_ist.append([name,code,current_price,price_list[i+1],buy_list[i+1],'-','清仓',\n",
    "                             '清仓','-',price_list[-1],price_list[0],count])\n",
    "        elif i==(count-1):\n",
    "            # 当前价格在最后一格前\n",
    "            # print name,code,current_price,price_list[i],buy_list[i],price_list[i-2],sell_list[i-2] \n",
    "            data_ist.append([name,code,current_price,price_list[i],buy_list[i],price_list[i-2],sell_list[i-2],\n",
    "                             '',near_price,price_list[-1],price_list[0],count])\n",
    "        else:  \n",
    "            # 当前价格在其余格内\n",
    "            # print name,code,current_price,price_list[i+1],buy_list[i+1],price_list[i-1],sell_list[i-1]        \n",
    "            data_ist.append([name,code,current_price,price_list[i+1],buy_list[i+1],price_list[i-1],sell_list[i-1],\n",
    "                             '',near_price,price_list[-1],price_list[0],count])\n",
    "    \n",
    "    notice_df=pd.DataFrame(data=data_ist,columns=['名称','代码','当前价','买入价','买入数',\n",
    "                                           '卖出价','卖出数','说明','当前格','末格','首格','格数'])    \n",
    "    return notice_df\n",
    " \n",
    "def get_wg_report(notice_df):\n",
    "    # 保留必要信息\n",
    "    del notice_df['说明']\n",
    "    del notice_df['当前格']\n",
    "    del notice_df['末格']\n",
    "    del notice_df['首格']\n",
    "    del notice_df['格数']\n",
    "    # 整理对齐方式\n",
    "    notice_df['名称']='#'+notice_df['名称']\n",
    "    notice_df['代码']='#'+notice_df['代码']\n",
    "    notice_df.rename(columns={'名称':'$名称','代码':'$代码'},inplace=True)\n",
    "    # 返回表格\n",
    "    return notice_df.to_html(index=False,justify='right',\n",
    "               classes='border=\"1\" cellspacing=\"0\" cellpadding=\"4\" rules=\"rows\" frame=\"void\"')\\\n",
    "              .replace('<th></th>','<th>$代码</th>').replace('<tr>','<tr align=\"right\">')\\\n",
    "            .replace('<th>$','<th align=\"left\">').replace('<td>#','<td align=\"left\">')\n",
    "        \n",
    "file_name='../../Data/网格-交易A.xlsm' \n",
    "etf_dict=get_wg_info(file_name)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>名称</th>\n",
       "      <th>代码</th>\n",
       "      <th>当前价</th>\n",
       "      <th>买入价</th>\n",
       "      <th>买入数</th>\n",
       "      <th>卖出价</th>\n",
       "      <th>卖出数</th>\n",
       "      <th>说明</th>\n",
       "      <th>当前格</th>\n",
       "      <th>末格</th>\n",
       "      <th>首格</th>\n",
       "      <th>格数</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>银行ETF</td>\n",
       "      <td>512800</td>\n",
       "      <td>0.983</td>\n",
       "      <td>0.947</td>\n",
       "      <td>800</td>\n",
       "      <td>0.990</td>\n",
       "      <td>800</td>\n",
       "      <td></td>\n",
       "      <td>0.968</td>\n",
       "      <td>0.887</td>\n",
       "      <td>1.180</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>H股ETF</td>\n",
       "      <td>510900</td>\n",
       "      <td>1.199</td>\n",
       "      <td>1.172</td>\n",
       "      <td>900</td>\n",
       "      <td>1.224</td>\n",
       "      <td>800</td>\n",
       "      <td></td>\n",
       "      <td>1.198</td>\n",
       "      <td>0.945</td>\n",
       "      <td>1.306</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>证券ETF</td>\n",
       "      <td>512880</td>\n",
       "      <td>0.841</td>\n",
       "      <td>0.81</td>\n",
       "      <td>1200</td>\n",
       "      <td>0.851</td>\n",
       "      <td>1200</td>\n",
       "      <td></td>\n",
       "      <td>0.83</td>\n",
       "      <td>0.698</td>\n",
       "      <td>1.295</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>创业板</td>\n",
       "      <td>159915</td>\n",
       "      <td>1.301</td>\n",
       "      <td>1.22</td>\n",
       "      <td>800</td>\n",
       "      <td>1.308</td>\n",
       "      <td>800</td>\n",
       "      <td></td>\n",
       "      <td>1.263</td>\n",
       "      <td>1.099</td>\n",
       "      <td>1.951</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>创业板50</td>\n",
       "      <td>159949</td>\n",
       "      <td>0.477</td>\n",
       "      <td>0.448</td>\n",
       "      <td>2200</td>\n",
       "      <td>0.481</td>\n",
       "      <td>2200</td>\n",
       "      <td></td>\n",
       "      <td>0.464</td>\n",
       "      <td>0.433</td>\n",
       "      <td>0.785</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>500ETF</td>\n",
       "      <td>510500</td>\n",
       "      <td>4.830</td>\n",
       "      <td>4.576</td>\n",
       "      <td>200</td>\n",
       "      <td>4.883</td>\n",
       "      <td>200</td>\n",
       "      <td></td>\n",
       "      <td>4.727</td>\n",
       "      <td>4.430</td>\n",
       "      <td>7.658</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>华宝油气</td>\n",
       "      <td>162411</td>\n",
       "      <td>0.501</td>\n",
       "      <td>-</td>\n",
       "      <td>满仓</td>\n",
       "      <td>0.518</td>\n",
       "      <td>1200</td>\n",
       "      <td>破网</td>\n",
       "      <td>-</td>\n",
       "      <td>0.504</td>\n",
       "      <td>0.824</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>券商ETF</td>\n",
       "      <td>512000</td>\n",
       "      <td>0.801</td>\n",
       "      <td>0.768</td>\n",
       "      <td>1300</td>\n",
       "      <td>0.807</td>\n",
       "      <td>1300</td>\n",
       "      <td></td>\n",
       "      <td>0.787</td>\n",
       "      <td>0.662</td>\n",
       "      <td>1.228</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       名称      代码    当前价    买入价   买入数    卖出价   卖出数  说明    当前格     末格     首格  \\\n",
       "0   银行ETF  512800  0.983  0.947   800  0.990   800      0.968  0.887  1.180   \n",
       "1   H股ETF  510900  1.199  1.172   900  1.224   800      1.198  0.945  1.306   \n",
       "2   证券ETF  512880  0.841   0.81  1200  0.851  1200       0.83  0.698  1.295   \n",
       "3     创业板  159915  1.301   1.22   800  1.308   800      1.263  1.099  1.951   \n",
       "4   创业板50  159949  0.477  0.448  2200  0.481  2200      0.464  0.433  0.785   \n",
       "5  500ETF  510500  4.830  4.576   200  4.883   200      4.727  4.430  7.658   \n",
       "6    华宝油气  162411  0.501      -    满仓  0.518  1200  破网      -  0.504  0.824   \n",
       "7   券商ETF  512000  0.801  0.768  1300  0.807  1300      0.787  0.662  1.228   \n",
       "\n",
       "   格数  \n",
       "0  14  \n",
       "1  16  \n",
       "2  26  \n",
       "3  21  \n",
       "4  21  \n",
       "5  21  \n",
       "6  18  \n",
       "7  26  "
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "notice_df=get_wg_notice(etf_dict)\n",
    "notice_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<table border=\"1\" class=\"dataframe border=\"1\" cellspacing=\"0\" cellpadding=\"4\" rules=\"rows\" frame=\"void\"\">\n",
      "  <thead>\n",
      "    <tr style=\"text-align: right;\">\n",
      "      <th align=\"left\">名称</th>\n",
      "      <th align=\"left\">代码</th>\n",
      "      <th>当前价</th>\n",
      "      <th>买入价</th>\n",
      "      <th>买入数</th>\n",
      "      <th>卖出价</th>\n",
      "      <th>卖出数</th>\n",
      "    </tr>\n",
      "  </thead>\n",
      "  <tbody>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">银行ETF</td>\n",
      "      <td align=\"left\">512800</td>\n",
      "      <td>0.983</td>\n",
      "      <td>0.947</td>\n",
      "      <td>800</td>\n",
      "      <td>0.990</td>\n",
      "      <td>800</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">H股ETF</td>\n",
      "      <td align=\"left\">510900</td>\n",
      "      <td>1.199</td>\n",
      "      <td>1.172</td>\n",
      "      <td>900</td>\n",
      "      <td>1.224</td>\n",
      "      <td>800</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">证券ETF</td>\n",
      "      <td align=\"left\">512880</td>\n",
      "      <td>0.841</td>\n",
      "      <td>0.81</td>\n",
      "      <td>1200</td>\n",
      "      <td>0.851</td>\n",
      "      <td>1200</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">创业板</td>\n",
      "      <td align=\"left\">159915</td>\n",
      "      <td>1.301</td>\n",
      "      <td>1.22</td>\n",
      "      <td>800</td>\n",
      "      <td>1.308</td>\n",
      "      <td>800</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">创业板50</td>\n",
      "      <td align=\"left\">159949</td>\n",
      "      <td>0.477</td>\n",
      "      <td>0.448</td>\n",
      "      <td>2200</td>\n",
      "      <td>0.481</td>\n",
      "      <td>2200</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">500ETF</td>\n",
      "      <td align=\"left\">510500</td>\n",
      "      <td>4.830</td>\n",
      "      <td>4.576</td>\n",
      "      <td>200</td>\n",
      "      <td>4.883</td>\n",
      "      <td>200</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">华宝油气</td>\n",
      "      <td align=\"left\">162411</td>\n",
      "      <td>0.501</td>\n",
      "      <td>-</td>\n",
      "      <td>满仓</td>\n",
      "      <td>0.518</td>\n",
      "      <td>1200</td>\n",
      "    </tr>\n",
      "    <tr align=\"right\">\n",
      "      <td align=\"left\">券商ETF</td>\n",
      "      <td align=\"left\">512000</td>\n",
      "      <td>0.801</td>\n",
      "      <td>0.768</td>\n",
      "      <td>1300</td>\n",
      "      <td>0.807</td>\n",
      "      <td>1300</td>\n",
      "    </tr>\n",
      "  </tbody>\n",
      "</table>\n"
     ]
    }
   ],
   "source": [
    "print get_wg_report(notice_df)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<table border=\"1\" class=\"dataframe border=\"1\" cellspacing=\"0\" cellpadding=\"4\" rules=\"rows\" frame=\"void\"\">\n",
    "  <thead>\n",
    "    <tr style=\"text-align: center;\">\n",
    "      <th>名称</th>\n",
    "      <th>代码</th>\n",
    "      <th>当前价</th>\n",
    "      <th>买入价</th>\n",
    "      <th>买入数</th>\n",
    "      <th>卖出价</th>\n",
    "      <th>卖出数</th>\n",
    "    </tr>\n",
    "  </thead>\n",
    "  <tbody style=\"text-align:right;\">\n",
    "    <tr>\n",
    "      <td>银行ETF</td>\n",
    "      <td>512800</td>\n",
    "      <td>0.972</td>\n",
    "      <td>0.947</td>\n",
    "      <td>800</td>\n",
    "      <td>0.990</td>\n",
    "      <td>800</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "      <td>H股ETF</td>\n",
    "      <td>510900</td>\n",
    "      <td>1.196</td>\n",
    "      <td>1.147</td>\n",
    "      <td>900</td>\n",
    "      <td>1.198</td>\n",
    "      <td>900</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "      <td>证券ETF</td>\n",
    "      <td>512880</td>\n",
    "      <td>0.840</td>\n",
    "      <td>0.81</td>\n",
    "      <td>1200</td>\n",
    "      <td>0.851</td>\n",
    "      <td>1200</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "      <td>创业板</td>\n",
    "      <td>159915</td>\n",
    "      <td>1.299</td>\n",
    "      <td>1.22</td>\n",
    "      <td>800</td>\n",
    "      <td>1.308</td>\n",
    "      <td>800</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "      <td>创业板50</td>\n",
    "      <td>159949</td>\n",
    "      <td>0.477</td>\n",
    "      <td>0.448</td>\n",
    "      <td>2200</td>\n",
    "      <td>0.481</td>\n",
    "      <td>2200</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "      <td>500ETF</td>\n",
    "      <td>510500</td>\n",
    "      <td>4.815</td>\n",
    "      <td>4.576</td>\n",
    "      <td>200</td>\n",
    "      <td>4.883</td>\n",
    "      <td>200</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "      <td>华宝油气</td>\n",
    "      <td>162411</td>\n",
    "      <td>0.500</td>\n",
    "      <td>-</td>\n",
    "      <td>满仓</td>\n",
    "      <td>0.518</td>\n",
    "      <td>1200</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "      <td>券商ETF</td>\n",
    "      <td>512000</td>\n",
    "      <td>0.801</td>\n",
    "      <td>0.768</td>\n",
    "      <td>1300</td>\n",
    "      <td>0.807</td>\n",
    "      <td>1300</td>\n",
    "    </tr>\n",
    "  </tbody>\n",
    "</table>"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2 (PacVer 2.0)",
   "language": "python",
   "name": "python2new"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
